<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05 demo1</title>
</head>

<body>
    <h1>input事件</h1>
    
    <input type="text" id="username">
    <p>在输入时请检查控制台输出</p>
    <script>
        var username = document.getElementById("username");
        username.oninput = function (e) {
            console.log(e.target.value);
        }
    </script>
</body>

</html>